<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.meichaoit.entity.Account"%>
<%@page import="com.meichaoit.dao.AccountDao"%>
<%

	String toId = request.getParameter("userid");
	String  money = request.getParameter("money");
		
	AccountDao dao = new AccountDao();
	
	Account toAccount = dao.findById(Integer.valueOf(toId));
	Account fromAccount = (Account)session.getAttribute("account");
	
	toAccount.setMoney(toAccount.getMoney()+Float.valueOf(money));
	fromAccount.setMoney(fromAccount.getMoney()-Float.valueOf(money));
	
	dao.update(toAccount);
	dao.update(fromAccount);
	
	response.sendRedirect("main.jsp");
%>